<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .dialog-wrapper {
            height: 200px;
            background-color: skyblue;
            position: relative;
            display: flex;
            justify-content: center;
        }

        .dialog-center {
            height: 200px;
            width: 500px;

            background-color: white;
        }

        .content {
            width: 500px;
            height: 100px;
        }

        .btn-wrapper {
            display: flex;
            justify-content: space-around;
        }
    </style>
</head>

<body>
    <button onclick="openDialog()">
        打开对话框
    </button>
    <div class="dialog-wrapper">
        <div class="dialog-center">
            <p>是否删除这条信息?</p>
            <div class="content"></div>
            <p class="btn-wrapper">
                <button class="left" onclick="deleteNo()">取消</button>
                <button class="right" onclick="deleteOk()">确定</button>
            </p>
        </div>
    </div>
    <script type="text/javascript">
        var dialogStatus = "none"

        function changeDialogStatus() {
            document.getElementsByClassName("dialog-center")[0].style.display = dialogStatus
            if (this.dialogStatus == "none") {
                this.dialogStatus = ""
            } else {
                this.dialogStatus = "none"
            }
        }
        function openDialog() {
            
            this.changeDialogStatus()

        }
        function deleteNo() {
            this.changeDialogStatus()
        }
        function deleteOk() {
            this.changeDialogStatus()
            setTimeout(() => {
                alert("删除成功!")
            }, 50)
        }
    </script>
</body>

</html>